<!DOCTYPE html>
<html lang="zh" xmlns:th="http://www.thymeleaf.org" >
<head>
    <th:block th:include="include :: header('新增财务管理')" />
    <th:block th:include="include :: datetimepicker-css" />
    <th:block th:include="include :: bootstrap-fileinput-css"/>
</head>
<body class="white-bg">
<style>
    .jltable{
        margin: auto;
    }
    .jltable th,td{
        min-height: 40px;
        min-width: 50px;
        border: 1px solid #eee;
        padding: 10px;
    }
</style>
<div class="wrapper wrapper-content animated fadeInRight ibox-content">
    <form class="form-horizontal m" id="form-cwgl-add">
        <h4 class="form-header h4">财务信息</h4>
        <table class="jltable">
            <tbody>
                    <tr>
                        <td><label class="control-label is-required">类型：</label></td>
                        <td>
                            <select name="lx" class="form-control" th:with="type=${@dict.getType('cwgllx')}" required>
                                <option th:each="dict : ${type}" th:text="${dict.dictLabel}" th:value="${dict.dictValue}"></option>
                            </select>
                        </td>
                        <td><label class="control-label">状态：</label></td>
                        <td>
                            <select name="zt" class="form-control" th:with="type=${@dict.getType('cwglzt')}">
                                <option th:each="dict : ${type}" th:text="${dict.dictLabel}" th:value="${dict.dictValue}"></option>
                            </select>
                        </td>
                    </tr>

                    <tr>
                        <td><label class="control-label">标题：</label></td>
                        <td><input name="bt" class="form-control" type="text"></td>
                        <td><label class="control-label">金额：</label></td>
                        <td><input name="je" class="form-control" type="text"></td>
                    </tr>

                    <tr>
                        <td><label class="control-label">部门：</label></td>
                        <td><input name="bm" class="form-control" type="text"></td>
                        <td><label class="control-label">账户：</label></td>
                        <td>
                            <select name="zh" class="form-control" th:with="type=${@dict.getType('cwglzh')}">
                                <option th:each="dict : ${type}" th:text="${dict.dictLabel}" th:value="${dict.dictValue}"></option>
                            </select>
                        </td>
                    </tr>

                    <tr>
                        <td><label class="control-label">经手人：</label></td>
                        <td><input name="jsr" class="form-control" type="text"></td>
                        <td><label class="control-label">时间：</label></td>
                        <td>
                            <div class="input-group date">
                                <input name="sj" class="form-control" placeholder="yyyy-MM-dd" type="text">
                                <span class="input-group-addon"><i class="fa fa-calendar"></i></span>
                            </div>
                        </td>
                    </tr>


                    <tr>
                        <td><label class="control-label">描述：</label></td>
                        <td colspan="3"><textarea name="ms" class="form-control"></textarea></td>
                    </tr>
                    <tr>
                        <td><label class="control-label">备注：</label></td>
                        <td colspan="3"><textarea name="bz" class="form-control"></textarea></td>
                    </tr>
                    <tr>
                        <td><label class="control-label">相关文件：</label></td>
                        <td colspan="3">
                            <input type="hidden" name="xgwj">
                            <div class="file-loading">
                                <input class="form-control file-upload" id="xgwj" name="file" type="file">
                            </div>
                        </td>
                    </tr>
            </tbody>
        </table>
    </form>
</div>
<th:block th:include="include :: footer" />
<th:block th:include="include :: datetimepicker-js" />
<th:block th:include="include :: bootstrap-fileinput-js"/>
<script th:inline="javascript">
    var prefix = ctx + "lwpq/cwgl"
    $("#form-cwgl-add").validate({
        focusCleanup: true
    });

    function submitHandler() {
        if ($.validate.form()) {
            $.operate.save(prefix + "/add", $('#form-cwgl-add').serialize());
        }
    }

            $("input[name='sj']").datetimepicker({
                format: "yyyy-mm-dd",
                minView: "month",
                autoclose: true
            });
    $(".file-upload").fileinput({
        uploadUrl: ctx + 'common/upload',
        maxFileCount: 1,
        autoReplace: true
    }).on('fileuploaded', function (event, data, previewId, index) {
        $("input[name='" + event.currentTarget.id + "']").val(data.response.url)
    }).on('fileremoved', function (event, id, index) {
        $("input[name='" + event.currentTarget.id + "']").val('')
    })
</script>
</body>
</html>